package commons.configuration;

import java.io.IOException;

import commons.exception.InvalidConfigurationException;

/**
 * Represents a generic configuration. A configuration here is understood as a
 * structure able to extract information from files, determine if the file's
 * format and its data are valid and provide the information to other classes.
 * Each Configuration implementation has its own definition of valid.
 * 
 * @author Armstrong Mardilson da Silva Goes
 */
public interface Configuration {

	/**
	 * Returns the value of the given parameter if it exist or null otherwise.
	 * 
	 * @param parameter
	 *            The parameter requested.
	 * @return The parameter value.
	 */
	String getConfigurationParameter(String parameter);

	/**
	 * Reads the file whose name is fileName, checks if the file's format and
	 * data are valid and stores the information to future use. The information
	 * that is already stored in the Configuration is overrided.
	 * 
	 * @param fileName
	 *            The name of the file where the data is stored.
	 * @throws {@link InvalidConfigurationException} If either the file's format
	 *         or the file's data is invalid.
	 * @throws {@link IOException} If there is an error in the file reading.
	 */
	void load(String fileName) throws InvalidConfigurationException,
			IOException;
}
